<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>OA员工管理系统</title>
    <link rel="stylesheet" href="assets/css/style.css">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, width=device-width">
    <meta name="description" content="Bitter Mobile Template">
    <meta name="keywords" content="bootstrap, mobile template, cordova, phonegap, mobile, html, responsive" />
    <script src="assets/js/lib/jquery-3.4.1.min.js"></script>
</head>

<body>

    <!-- Page loading -->
    <div class="loading">
        <div class="spinner-grow"></div>
    </div>
    <!-- * Page loading -->

    <!-- App Header -->
    <div class="appHeader">
        <div class="left">
            <a href="#" class="icon goBack">
                <i class="icon ion-ios-arrow-back"></i>
            </a>
        </div>
        <div class="pageTitle">
            审批
        </div>
        <div class="right">
        </div>
    </div>
    <!-- * App Header -->

    <!-- App Capsule -->
    <div id="appCapsule">

        <div class="appContent">

            <div class="splashBlock">

                <div class="sectionTitle text-center">
                    <table class="table table-hover">
                        <thead>
                            <tbody>
                                <tr class="table-active">
                                    <th scope="row">2020/3/15-14:00 </th>
                                    <td>同意</td>
                                </tr>
                                <tr class="table">
                                    <th scope="row">2020/3/15-14:00 </th>
                                    <td>待审批</td>
                                </tr>
                                <tr class="table-active">
                                    <th scope="row">2020/3/15-14:00 </th>
                                    <td>待审批</td>
                                </tr>

                            </tbody>
                    </table>
                </div>

            </div>

        </div>

    </div>
    <!-- appCapsule -->

    <script type="text/javascript">

        $(function () {
            $.ajax({
                url: "/OASystem/leave/levaeCheck",
                dataType: "json",
                type: "get",
                success: function (data) {
                   console.log(data)
                    var str = "";
                    $(data.data).each(function (index, item) {

                            str += '<tr class="table'+active(index)+'">\n' +
                                '<th scope="row">'+item.leaveTime+'</th>\n' +
                                '<td>'+state(item.audtiState,item.failMessage)+'</td>\n' +
                                '</tr>'

                    })
                    $("tbody").html(str)

                },
                error: function (err) {
                    alert("服务器出错");
                }
            });
        })

        function active(index) {
            return index % 2 != 0 ? "":"-active";
        }

        function state(stateNum, failMessage) {
            if (stateNum == 0){
                return "未审核";
            }else if(stateNum ==1){
                return "审核通过";
            }else {
                return "审核未通过:"+failMessage;
            }
        }

    </script>


    <!-- ///////////// Js Files ////////////////////  -->
    <!-- Jquery -->

    <!-- Bootstrap-->
    <script src="assets/js/lib/popper.min.js"></script>
    <script src="assets/js/lib/bootstrap.min.js"></script>
    <!-- Owl Carousel -->
    <script src="assets/js/plugins/owl.carousel.min.js"></script>
    <!-- Main Js File -->
    <script src="assets/js/app.js"></script>




</body>

</html>